#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;


class Solution {
public:
	int rob(vector<int>& nums) {
		int len = nums.size();
		if (len == 0) return 0;

		vector<int> dp(len,0);
		for (int i = 0;i < len;i++)
		{
			dp[i] = getM(i,nums,len);
		}

		for (int num : dp)
		{
			cout << num << " ";
		}
		cout << endl;

		return *max_element(dp.begin(),dp.end());
	}

	int getM(int pos, vector<int>& nums,const int len)
	{

		if (pos == len-1 || pos == len - 2)
		{
			return nums[pos];
		}
		else
		{
			return nums[pos] + getM(pos+2,nums,len);
		}
	}
};

int main()
{
	vector<int> v{ 1,2,3,1 };
	Solution s;
	int res = s.rob(v);
	cout << res << endl;
	return 0;
}